package util.urlSpider;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

public class Test {

	public static void main(String[] args) throws JDOMException, IOException {

		SAXBuilder builder = new SAXBuilder(false);
		Document doc = builder.build("spiderSuit.xml");
		Element parameter = doc.getRootElement();
		List sourceSiteParameterList = parameter.getChildren("sourceSite");
		for (Iterator<?> iter = sourceSiteParameterList.iterator(); iter.hasNext();) {
			SpiderRobotURL sru = new SpiderRobotURL();
			Element element = (Element) iter.next();
			sru.setCodeNo(element.getChildTextTrim("codeNo"));
			sru.setCookiesString("");
			sru.setdBName("feiji");
			sru.setEnd(element.getChildTextTrim("end"));
			sru.setFirst("http://www.sogou.com/web?query=");
			sru.setHead("");
			sru.setHost("192.168.0.7");
			sru.setLookRex(element.getChildTextTrim("lookRex"));
			sru.setPagingRex("");
			sru.setPagingRexHead("");
			sru.setProxyString("");
			sru.setSourceNet(4);
			sru.setUrlPattern(element.getChildTextTrim("urlPattern"));
			//System.out.println(element.getChildTextTrim("urlPattern"));
			sru.run();
		}
	}

}
